﻿package II.controls {
	
	import flash.display.*;
	import flash.events.*;
	import II.util.*;
	import II.controls.*;
	import flash.geom.Point;
	
	
	public class UIManager {

		
		static public function set Root ( value:Stage ) : void {
			if ( _Root == value ) return;
			if ( _Root != null ) {
				_Root.removeEventListener ( MouseEvent.MOUSE_DOWN, UIManager.onMouseDown );
				_Root.removeEventListener ( MouseEvent.MOUSE_MOVE, UIManager.onMouseMove );
				_Root.removeEventListener ( MouseEvent.MOUSE_UP, UIManager.onMouseUp );
			}
			_Root = value;
			if ( _Root != null ) {
				_Root.addEventListener ( MouseEvent.MOUSE_DOWN, UIManager.onMouseDown );
				_Root.addEventListener ( MouseEvent.MOUSE_MOVE, UIManager.onMouseMove );
				_Root.addEventListener ( MouseEvent.MOUSE_UP, UIManager.onMouseUp );
			}
			
		}
		static public function get Root () : Stage {
			return _Root;
		}
		static private var _Root:Stage = null;
		
		
		
		
		static private var cursor:CursorPath = new CursorPath();
		

		
		
		static private function onMouseUp ( event:MouseEvent ) : void {
			trace ( "mouse up" );
		}
		
		static private function onMouseDown ( event:MouseEvent ) : void {
			var uiParent:UIBase = Util.FindParentWithClass ( event.target, UIBase ) as UIBase;
			
		}
		
		static private function onMouseMove ( event:MouseEvent ) : void {
			trace ( "mouse move" );
		}
		
	}
	
}
